Skip to content

Normative: Don't fall back to default locale in Locale.p.getCollations() - #1072

Merged
gibson042 merged 1 commit into
tc39:mainfrom
ptomato:1053-collations-of-locale
Jul 23, 2026
Merged

Normative: Don't fall back to default locale in Locale.p.getCollations()#1072
gibson042 merged 1 commit into
tc39:mainfrom
ptomato:1053-collations-of-locale

Conversation

@ptomato

@ptomato ptomato commented May 29, 2026

Copy link
Copy Markdown
Contributor

This is Anba's proposed change from the issue. It would change the handling of locales with undefined languages such as und-u-co-emoji and also remove the fallback to the default locale (so LANG= environment variables would have no effect.)

Closes: #1053

@sffc sffc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it more consistent with other ops like the one for numbering system. Thanks!

@sffc sffc moved this to Priority Issues in ECMA-402 Meeting Topics Jun 10, 2026
@FrankYFTang

Copy link
Copy Markdown
Contributor

How this PR should be test. Could someone illustrate the method of testing by drafting a test262 PR?

@anba

anba commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Could someone illustrate the method of testing by drafting a test262 PR?

This is not testable in test262, because it requires setting the default locale. See #1053 (comment).

@FrankYFTang

Copy link
Copy Markdown
Contributor

Could someone illustrate the method of testing by drafting a test262 PR?

This is not testable in test262, because it requires setting the default locale. See #1053 (comment).

if so, then how is this change meaningful?

@sffc

sffc commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Suppose your browser locale is zh.

new Intl.Locale("abcdefgh").getCollations()

// Old behavior: emoji,eor,pinyin,stroke,zhuyin
// New behavior: emoji,eor

The result should not depend on the browser locale.

@ptomato

ptomato commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

I'd have to page the context back in as it's been a few weeks since I looked at this, but I believe there is a change to und locales such as und-u-co-emoji that would be testable in test262. I'll follow up here.

@sffc

sffc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@ptomato ptomato moved this from Priority Issues to Previously Discussed in ECMA-402 Meeting Topics Jul 8, 2026
This is Anba's proposed change from the issue.

Closes: tc39#1053
@ptomato
ptomato force-pushed the 1053-collations-of-locale branch from 44034b3 to 668f293 Compare July 22, 2026 23:27
@ptomato

ptomato commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased.

ptomato added a commit to ptomato/test262 that referenced this pull request Jul 23, 2026
This commit provides additional coverage for the CollationsOfLocale AO,
in preparation for the normative change in
tc39/ecma402#1072.

LLM disclosure: I used a bot to draft these tests, and hand-edited them
until I was satisfied. default-locale-fallback.js is heavily commented,
but I did actually remove all the LLM comment spew; what's left are my
own comments.
ptomato added a commit to ptomato/test262 that referenced this pull request Jul 23, 2026
With normative PR tc39/ecma402#1072, the
unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return
the root collations ["emoji", "eor"] from getCollations(). The und
locales are no longer hardcoded, but it's a safe assumption that they
will also return the root collations. Combine the two tests that dealt
with und and unmatched locales into one.
ptomato added a commit to ptomato/test262 that referenced this pull request Jul 23, 2026
This commit provides additional coverage for the CollationsOfLocale AO,
in preparation for the normative change in
tc39/ecma402#1072.

LLM disclosure: I used a bot to draft these tests, and hand-edited them
until I was satisfied. default-locale-fallback.js is heavily commented,
but I did actually remove all the LLM comment spew; what's left are my
own comments.
ptomato added a commit to ptomato/test262 that referenced this pull request Jul 23, 2026
With normative PR tc39/ecma402#1072, the
unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return
the root collations ["emoji", "eor"] from getCollations(). The und
locales are no longer hardcoded, but it's a safe assumption that they
will also return the root collations. Combine the two tests that dealt
with und and unmatched locales into one.
@ptomato

ptomato commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Tests in tc39/test262#5092.

Note that it is indeed not possible to test the change directly. I've added a test that may or may not fail if the change is not implemented, depending on the default locale, but should always pass after the change regardless of the default locale. Testing it locally on d8, for example, it fails with LC_ALL=de in the environment.

@gibson042
gibson042 merged commit b76fb17 into tc39:main Jul 23, 2026
2 checks passed
@ptomato
ptomato deleted the 1053-collations-of-locale branch July 23, 2026 16:21
gibson042 pushed a commit to gibson042/test262 that referenced this pull request Jul 23, 2026
This commit provides additional coverage for the CollationsOfLocale AO,
in preparation for the normative change in
tc39/ecma402#1072.

LLM disclosure: I used a bot to draft these tests, and hand-edited them
until I was satisfied. default-locale-fallback.js is heavily commented,
but I did actually remove all the LLM comment spew; what's left are my
own comments.
gibson042 pushed a commit to gibson042/test262 that referenced this pull request Jul 23, 2026
With normative PR tc39/ecma402#1072, the
unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return
the root collations ["emoji", "eor"] from getCollations(). The und
locales are no longer hardcoded, but it's a safe assumption that they
will also return the root collations. Combine the two tests that dealt
with und and unmatched locales into one.
gibson042 pushed a commit to gibson042/test262 that referenced this pull request Jul 23, 2026
This commit provides additional coverage for the CollationsOfLocale AO,
in preparation for the normative change in
tc39/ecma402#1072.

LLM disclosure: I used a bot to draft these tests, and hand-edited them
until I was satisfied. default-locale-fallback.js is heavily commented,
but I did actually remove all the LLM comment spew; what's left are my
own comments.
gibson042 pushed a commit to gibson042/test262 that referenced this pull request Jul 23, 2026
With normative PR tc39/ecma402#1072, the
unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return
the root collations ["emoji", "eor"] from getCollations(). The und
locales are no longer hardcoded, but it's a safe assumption that they
will also return the root collations. Combine the two tests that dealt
with und and unmatched locales into one.
ptomato added a commit to tc39/test262 that referenced this pull request Jul 24, 2026
This commit provides additional coverage for the CollationsOfLocale AO,
in preparation for the normative change in
tc39/ecma402#1072.

LLM disclosure: I used a bot to draft these tests, and hand-edited them
until I was satisfied. default-locale-fallback.js is heavily commented,
but I did actually remove all the LLM comment spew; what's left are my
own comments.
ptomato added a commit to tc39/test262 that referenced this pull request Jul 24, 2026
With normative PR tc39/ecma402#1072, the
unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return
the root collations ["emoji", "eor"] from getCollations(). The und
locales are no longer hardcoded, but it's a safe assumption that they
will also return the root collations. Combine the two tests that dealt
with und and unmatched locales into one.
lahma added a commit to sebastienros/jint that referenced this pull request Jul 29, 2026
Bumps the pinned suite to defaaf1571cd13b183e3f505c6a06e8db316e593. Three
things came in with it, and all three needed engine work to stay green.

Iterator.prototype.join (https://github.com/tc39/proposal-iterator-join) is the
new feature, with 18 tests. Joining is the easy half; which failures close the
receiver is the part worth reading the tests for. Coercing the separator closes
it, and so does coercing a value the iterator produced. An abrupt `next` lookup,
a throwing `next()`, and a protocol violation (a step result that is not an
object) all propagate without closing, because IteratorStepValue marks the
record done first. Exhaustion does not close either. The separator is coerced
*before* `next` is read, so a receiver whose `next` getter throws never gets
that far, and `next` is read exactly once however many steps follow. Nullish
values format as the empty string, as they do in Array.prototype.join.

Intl.Locale.prototype.getCollations picked up a normative change
(tc39/ecma402#1072): a tag matching no available
Collator locale no longer falls back to the default locale — it reports the
hardcoded root collations « "emoji", "eor" » — and the result is now sorted in
lexicographic code unit order. Jint reported a single-element ["default"] for
every locale, and "default" is Jint's internal placeholder for "no collation was
requested", not an identifier a locale can report at all. It now reports the
root collations plus whatever the language adds, sorted; an explicitly requested
collation, however it was requested, is still the whole answer. The data comes
from the table CollatorConstructor already kept, so nothing new was invented:
"de" reports ["emoji","eor","phonebk"], "zh" its seven, "tr" and "und" and any
private-use tag the bare root pair.

import-defer grew IsModuleSCCEvaluated, and Jint needed it. A module that
finished its own body is only really done once the strongly connected component
it belongs to is: a member of an async cycle reaches EVALUATED as soon as its
body returns, while the cycle root sits in EVALUATING-ASYNC awaiting a top-level
await. Reading the member's own status is what
GatherAsynchronousTransitiveDependencies and ReadyForSyncExecution were doing,
so a deferred subgraph reaching into such a cycle looked free of async
dependencies — and the deferring module ran its body, and took its deferred
namespace, before the cycle had finished. The new test walks exactly that graph.
ReadyForSyncExecution refuses an EVALUATED-but-not-SCC-evaluated module rather
than asserting on it: the spec asserts LINKED at that point, having convinced
itself the state is unreachable, and refusing is both the conservative answer
and the one EvaluateSync already turns into the spec's TypeError.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs consensus needs review normative s: discuss Status: TG2 must discuss to move forward

Projects

Status: Previously Discussed

Development

Successfully merging this pull request may close these issues.

CollationsOfLocale: Reconsider calling DefaultLocale

5 participants